package com.example.myfirstapplication

val permissionList = ArrayList<Map<String, String>>().apply {
    add(mapOf("key" to "Manifest.permission.CALL_PHONE", "title" to "拨打电话"))
    add(mapOf("key" to "Manifest.permission.READ_CONTACTS", "title" to "读取联系人信息"))
}

fun getPermissionTitle(permissionName: String): String {
    var returnMsg = ""
    for ((index, item) in permissionList.withIndex()) {
        if (permissionName == item["key"]) {
            returnMsg = item["title"].toString()
            break
        }
    }
    return returnMsg
}